package com.yaoxun.quartz.repository.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import com.yaoxun.quartz.domain.entity.ScheduleJobLog;
import com.yaoxun.quartz.repository.ScheduleJobLogDao;

@Repository
public class ScheduleJobLogDaoImpl implements ScheduleJobLogDao {
	
	@Autowired
	private JdbcTemplate jdbcTemplate;

	@Override
	public int insert(ScheduleJobLog scheduleJobLog) {
		String sql = "insert into schedule_job_log(job_id, bean_name, params, run_status, error_info, times, create_time) "
				+ "values(?, ?, ?, ?, ?, ?, ?)";
		int effectNum = jdbcTemplate.update(sql, scheduleJobLog.getJobId(), scheduleJobLog.getBeanName(), 
				scheduleJobLog.getParams(), scheduleJobLog.getRunStatus(), scheduleJobLog.getErrorInfo(), 
				scheduleJobLog.getTimes(), scheduleJobLog.getCreateTime());
		return effectNum;
	}

	
	
}
